package com.yunhe.device.domain;

import com.yunhe.common.util.Neo4jConditionUtil.FILTERING_MODE;
import com.yunhe.common.util.Neo4jConditionUtil.MATCH_MODE;
import com.yunhe.common.util.Neo4jConditionUtil.RELATION_DIRECTION;

import java.util.List;

/**
 * Neo4j条件对象
 * @desc Neo4j条件对象定义
 * @author liuronglei
 */
public class Neo4jCondition {
    private String paramName;
    private Object paramValue;
    private String relationName;
    private MATCH_MODE matchMode = MATCH_MODE.EQUALS;
    private RELATION_DIRECTION relationDirection;
    private FILTERING_MODE filteringMode = FILTERING_MODE.AND;
    private List<Neo4jCondition> relationConditions;

    public String getParamName() {
        return paramName;
    }

    public Object getParamValue() {
        return paramValue;
    }

    public RELATION_DIRECTION getRelationDirection() {
        return relationDirection;
    }

    public FILTERING_MODE getFilteringMode() {
        return filteringMode;
    }

    public List<Neo4jCondition> getRelationConditions() {
        return relationConditions;
    }

    public void setFilteringMode(FILTERING_MODE filteringMode) {
        this.filteringMode = filteringMode;
    }

    public String getRelationName() {
        return relationName;
    }

    public MATCH_MODE getMatchMode() {
        return matchMode;
    }

    /**
     * 设置属性
     * @param paramName 属性名
     * @param paramValue 属性值
     */
    public void setParam(String paramName, Object paramValue) {
        setParam(paramName, paramValue, MATCH_MODE.EQUALS);
    }

    /**
     * 设置属性
     * @param paramName 属性名
     * @param paramValue 属性值
     * @param matchMode 匹配模式
     */
    public void setParam(String paramName, Object paramValue, MATCH_MODE matchMode) {
        this.paramName = paramName;
        this.paramValue = paramValue;
        this.matchMode = matchMode;
    }

    /**
     * 设置关系
     * @param relationName 关系名
     * @param relationDirection 关系方向
     * @param relationConditions 关系对象条件
     */
    public void setRelation(String relationName, RELATION_DIRECTION relationDirection, List<Neo4jCondition> relationConditions) {
        this.relationName = relationName;
        this.relationDirection = relationDirection;
        this.relationConditions = relationConditions;
    }
}
